Skip to content

refactor: extract extensible shared smoothing engine - #2452

Open
changwangss wants to merge 11 commits into
intel:mainfrom
changwangss:refactor/shared-smoothing
Open

changwangss wants to merge 11 commits into
intel:mainfrom
changwangss:refactor/shared-smoothing

Conversation

@changwangss

Copy link
Copy Markdown
Contributor

Description

AWQ and SVDQuant maintain separate smoothing workflows. Extract an algorithm-independent SmoothEngine, SmoothGroup, and structural SmoothStrategy interface, and route both algorithms through the shared engine. New algorithms supply preparation, candidates, scoring, application, and cleanup without adding algorithm branches to the engine.

Preserve AWQ's activation/weight means, ratio/duo grid, QDQ loss, folding, and clipping synchronization; preserve SVDQuant's absmax statistics, Alpha/Beta grid, deployed-scale precision, and low-rank-aware scoring. Keep smoothing optional for SVDQuant and retain its search-all-groups-before-installation order. Existing configuration and SVDQuant smooth imports remain available.

Both algorithms now keep the first exact tie and share numerical-invalid candidate handling, logging, trial-state restoration, and cleanup. Execution errors, including OOM, propagate. AWQ retains its no-valid-candidate skip fallback; SVDQuant retains its error behavior. Joint AWQ + SVDQuant execution and broader model support remain follow-up work.

Type of Change

Refactor

Related Issues

Closes #2451

Validation

  • 78 focused tests passed: 55 smoothing/strategy/SVDQuant pipeline tests and 23 existing AWQ replay/mapping and MXFP4/W4A16/Nunchaku compatibility tests.
  • Runs used PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 and --noconftest to isolate self-contained tests; this is not a full repository test run.
  • All pre-commit checks passed for changed files.
  • Static comparison confirms extracted AWQ candidate/scoring closures and SVDQuant scoring preserve the original code apart from owner naming.

Checklist Before Submitting

  • My code has been tested locally.
  • Documentation has been updated as needed.
  • New or updated tests are included where applicable.
  • The CUDA CI has passed.

@changwangss
changwangss force-pushed the refactor/shared-smoothing branch from aac0d02 to 8e5e924 Compare October 8, 2026 14:05
Signed-off-by: changwangss <chang1.wang@intel.com>
@changwangss
changwangss force-pushed the refactor/shared-smoothing branch from 8e5e924 to 7d58d64 Compare October 20, 2026 07:30
@changwangss
changwangss marked this pull request as ready for review October 21, 2026 08:41
Copilot AI lite review requested due to automatic review settings October 21, 2026 08:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Three moderate issues remain in shared search and hook cleanup, along with a requested SVDQuant regression test.

No open issues 🎉

What changed in this PR

This refactor extracts a shared smoothing engine for AWQ and SVDQuant while preserving algorithm-specific behavior.

Changes:

  • Adds shared smoothing groups, strategies, calibration, replay, search, and error handling.
  • Migrates AWQ and SVDQuant workflows to the shared engine.
  • Adds compatibility tests and synchronized documentation.
File Summary Review notes
test/​unit/​common/​algorithms/​test_svdquant.py SVDQuant compatibility tests Reviewed
test/​unit/​common/​algorithms/​test_svdquant_smooth.py SVDQuant smoothing tests Reviewed
test/​unit/​common/​algorithms/​test_svdquant_residual.py Residual tie behavior tests Reviewed
test/​unit/​common/​algorithms/​test_smoothing.py Shared smoothing utility tests Reviewed
test/​unit/​common/​algorithms/​test_smoothing_engine.py Extensible engine tests Reviewed
test/​unit/​common/​algorithms/​test_smoothing_awq_compatibility.py AWQ compatibility tests Reviewed
docs/​svdquant_details.md English SVDQuant documentation Reviewed
docs/​svdquant_details_CN.md Chinese SVDQuant documentation Reviewed
auto_round/​algorithms/​transforms/​svdquant/​smooth.py SVDQuant strategy and compatibility exports Reviewed
auto_round/​algorithms/​transforms/​svdquant/​smooth_adapters/​base.py Shared group representation for SVDQuant Reviewed
auto_round/​algorithms/​transforms/​svdquant/​residual.py Residual tie preservation Reviewed
auto_round/​algorithms/​transforms/​svdquant/​apply.py Shared SVDQuant search and application Nit (1): add a multi-group partial-installation regression test
auto_round/​algorithms/​transforms/​smoothing/​search.py Shared candidate search Moderate (1): support None candidates; retain the selected error alongside the candidate
auto_round/​algorithms/​transforms/​smoothing/​scale.py Shared scale utilities Reviewed
auto_round/​algorithms/​transforms/​smoothing/​replay.py Hook replay and cleanup Moderate (1): roll back partially installed hooks when registration fails
auto_round/​algorithms/​transforms/​smoothing/​groups.py Shared smoothing groups Reviewed
auto_round/​algorithms/​transforms/​smoothing/​errors.py Shared smoothing errors Reviewed
auto_round/​algorithms/​transforms/​smoothing/​engine.py Shared smoothing engine Reviewed
auto_round/​algorithms/​transforms/​smoothing/​calibration.py Shared calibration utilities Reviewed
auto_round/​algorithms/​transforms/​smoothing/​__init__.py Shared smoothing exports Reviewed
auto_round/​algorithms/​transforms/​awq/​smooth.py AWQ smoothing strategy Reviewed
auto_round/​algorithms/​transforms/​awq/​base.py AWQ engine integration Reviewed
auto_round/​algorithms/​composer.py Hook and failure cleanup Reviewed

Review effort: Lite

@AutoRoundBot

Copy link
Copy Markdown
Collaborator

/azp run Unit-Test-CUDA-AutoRound

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: changwangss <chang1.wang@intel.com>
@AutoRoundBot

Copy link
Copy Markdown
Collaborator

/azp run Unit-Test-CUDA-AutoRound

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@changwangss

Copy link
Copy Markdown
Contributor Author

base 9920194
model: Qwen3-8B

Scheme GSM8K (%) HellaSwag (%) MMLU (%) PIQA (%) WinoGrande (%) AVG (%)
W4A16 87.41 56.03 72.18 76.66 69.61 72.38
MXFP4 85.14 54.07 69.55 75.08 68.98 70.56

from the awq details doc

Scheme GSM8K (%) HellaSwag (%) MMLU (%) PIQA (%) WinoGrande (%) AVG (%)
W4A16 86.50 56.07 72.23 76.55 69.14 72.10
MXFP4 83.70 53.89 69.54 75.57 68.19 70.18

Signed-off-by: changwangss <chang1.wang@intel.com>
Signed-off-by: changwangss <chang1.wang@intel.com>
Signed-off-by: changwangss <chang1.wang@intel.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

AWQ parent-forward scoring can leave trial weights installed when candidate evaluation raises, causing corrupted model state.

1 open issue

Review effort: Lite

Comment thread auto_round/algorithms/transforms/awq/smooth.py
Signed-off-by: changwangss <chang1.wang@intel.com>
Signed-off-by: changwangss <chang1.wang@intel.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open issues
1 resolved since last review

Review effort: Lite

Comment thread auto_round/algorithms/transforms/smoothing/engine.py
Comment thread auto_round/algorithms/transforms/smoothing/replay.py
Comment thread test/unit/common/algorithms/test_svdquant_smooth.py Outdated
Comment thread test/unit/common/algorithms/test_svdquant_smooth.py
@AutoRoundBot

Copy link
Copy Markdown
Collaborator

/azp run Unit-Test-CUDA-AutoRound

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: changwangss <chang1.wang@intel.com>
@AutoRoundBot

Copy link
Copy Markdown
Collaborator

/azp run Unit-Test-CUDA-AutoRound

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Extract an extensible shared smoothing engine for AWQ and SVDQuant

3 participants